package com.lhkj.ct.meta.modules.scheduling.model.entity;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.lhkj.ct.base.validator.group.ValGroups;
import com.lhkj.ct.meta.modules.scheduling.common.enums.ScheduleStatus;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;

/**
 * <p>
 * 排班记录
 * </p>
 *
 * @author jobob
 * @since 2023-10-27
 */
@Data
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="TblScheduling对象", description="排班记录")
public class TblScheduling implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "排班id")
    private String id;

    @ApiModelProperty(value = "科室")
    private String scheDept;

    @ApiModelProperty(value = "医生")
    private String scheDoc;

    @ApiModelProperty(value = "号源数量")
    private Integer scheNum;

    @NotNull(message = "日期不能为空", groups = {ValGroups.Delete.class})
    @ApiModelProperty(value = "排班日期")
    private LocalDate scheDate;

    @ApiModelProperty(value = "开始时间")
    @JsonFormat(pattern = "HH:mm")
    private LocalTime startTime;

    @ApiModelProperty(value = "截止时间")
    @JsonFormat(pattern = "HH:mm")
    private LocalTime endTime;

    @ApiModelProperty(value = "排班状态 -1.取消 0.正常 1.停号")
    private ScheduleStatus status;

    @TableField(fill = FieldFill.INSERT)
    @ApiModelProperty(value = "创建人")
    private String createBy;

    @TableField(fill = FieldFill.INSERT)
    @ApiModelProperty(value = "创建时间")
    private LocalDateTime createTime;

    @TableField(fill = FieldFill.UPDATE)
    @ApiModelProperty(value = "修改人")
    private String updateBy;

    @TableField(fill = FieldFill.UPDATE)
    @ApiModelProperty(value = "修改时间")
    private LocalDateTime updateTime;

    @TableField(exist = false)
    @ApiModelProperty(value = "已约")
    private Integer reducedNum;

    @TableField(exist = false)
    @ApiModelProperty(value = "剩余")
    private Integer residueNum;

    @TableField(exist = false)
    @ApiModelProperty(value = "班制", example = "上午班")
    private String shiftSystem;

    public static TblSchedulingBuilder builder() {
        return new TblSchedulingBuilder();
    }

    public static class TblSchedulingBuilder {
        private TblScheduling scheduling;

        public TblSchedulingBuilder() {
            scheduling = new TblScheduling();
        }

        public TblScheduling.TblSchedulingBuilder scheDept(String scheDept) {
            this.scheduling.scheDept = scheDept;
            return this;
        }
        public TblScheduling.TblSchedulingBuilder scheDoc(String scheDoc) {
            this.scheduling.scheDoc = scheDoc;
            return this;
        }
        public TblScheduling.TblSchedulingBuilder scheNum(Integer scheNum) {
            this.scheduling.scheNum = scheNum;
            return this;
        }
        public TblScheduling.TblSchedulingBuilder scheDate(LocalDate scheDate) {
            this.scheduling.scheDate = scheDate;
            return this;
        }
        public TblScheduling.TblSchedulingBuilder startTime(LocalTime startTime) {
            this.scheduling.startTime = startTime;
            return this;
        }
        public TblScheduling.TblSchedulingBuilder endTime(LocalTime endTime) {
            this.scheduling.endTime = endTime;
            return this;
        }
        public TblScheduling.TblSchedulingBuilder sStatus(ScheduleStatus status) {
            this.scheduling.status = status;
            return this;
        }

        public TblScheduling build() {
            return this.scheduling;
        }
    }
}
